<!-- Main Column -->
<div id="maincolumn">
<h2 class="main cpwd mtitle" id="main-title">New Category</h2>
<!-- Visual help : help tips and "Connected" label -->
  <!-- Create Poll address -->
	  <?=form_open('newCategory', array('id' => 'newCategory'))?>
              <dl class="small"><!-- ODF Name -->
                  <dt>
                      <label>Category Name</label>                                    
                  </dt>
                  <dd>
                      <?=form_input(array('name' 		=> 'pd_name',
                                          'id' 			=> 'pd_name',
                                          'class' 		=> 'inputtext w180 title'		 
                                          ))?>
                        
                  </dd>
              </dl>
              <dl class="small"><!-- ODF GPS Latitude -->
                <dt>
                    <label>Description</label>                                    
                </dt>
                <dd>
                   <?=form_input(array('name' 		=> 'pd_des',
                                      'id' 			=> 'pd_des',
                                      'class' 		=> 'inputtext w180'
                                      ))?>
                    
                </dd>
              </dl>
              
             <dl class="small"><!-- ODF GPS Latitude -->
                <dt>
                    <label>Image</label>                                    
                </dt>
                <dd>
                   <?=form_input(array('name' 		=> 'pd_image',
                                      'id' 			=> 'pd_image',
                                      'class' 		=> 'inputtext w180'
                                      ))?>
                    
                </dd>
          	 </dl>
            <!--button save and cancel -->
            <div class="buttons">	
                <input id="bCategory" type="button" class="button yes right mr40" value="<?= lang('pr_button_save') ?>" style="height:30px;width:50px;"/>     	
            </div>
      <?=form_close()?>
      <!--list table -->
          <div style="float:left;width:475px;">
            <fieldset style="border:1px solid #d9d9d9;padding:5px 5px;">
                <legend style="padding:0 5px;"><strong>Category Listing</strong></legend>
                <table class="list" id="category" style="width:600px;">
                    <thead>
                        <tr>
                            <th axis="number" width="8%">N&deg;</th>
                             <th axis="string">Cat_ID</th>
                            <th axis="string">Category</th>
                            <th axis="string">Description</th>
                            <th axis="string">Image</th>
                        </tr>
                    </thead>          
                    <tbody>	
                    <?php
                        $i = 0;
                        $altrow = '';
                        $r = 0;
                        $str = '';
                        foreach ($categorys as $category) :
                            ++$i;
                            if(strlen($i) == 1)		$str = '00';
                            elseif (strlen($i) == 2)	$str = '0';
                            else{}
                            
                            if($r % 2 == 0)	$altrow = 'class="odd"'; 
                            else $altrow = 'class="even"';
                        
                            echo '<tr '.$altrow.' onmouseover="this.style.backgroundColor= \'#eafaff\'" onmouseout="this.style.backgroundColor= \'\'">
                                      <td>'.$str.$i.'</td>
                                      <td>'.$category['cat_id'].'</td>
                                      <td>'.$category['cat_name'].'</td>
                                      <td>'.$category['cat_des'].'</td>
									  <td>'.$category['cat_image'].'</td></tr>';
                            $r++;
                        endforeach ;
                    ?>
                    </tbody>
                </table>
            </fieldset>
          </div>
      <!--end list table -->
</div> <!-- /maincolumn -->

<script type="application/javascript">
	/**
	 * Sortable on the current users list table
	 *
	 */
	new SortableTable('category',{sortOn: 0, sortBy: 'ASC'});
		
	ION.setFormSubmit('newCategory', 'bCategory', 'pr_category_cl/page_insert_category_submit');
	
	// Auto-generate Main title
	$$('.title').each(function(input, idx)
	{
		input.addEvent('keyup', function(e)
		{
			$$('.mtitle').set('text', this.value);
		});
	});
</script>

